package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import Signup.AccountManagement;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;

public class Reservation extends JFrame {

	private JPanel contentPane;

	public Reservation() {
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setSize(975, 770);
		contentPane = new JPanel() {
			public void paintComponent(Graphics g) {
				Image image = new ImageIcon("src/source/image/res_bg.png")
						.getImage();
				g.drawImage(image, 0, 0, this);
			}
		};

		setContentPane(contentPane);
		contentPane.setLayout(null);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

		JButton Reserve = new JButton(new ImageIcon(
				"src/source/image/btn_res1.png"));

		Reserve.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Login lg = new Login();
				lg.setSize(975, 770);
				lg.setVisible(true);
			}
		});

		Reserve.setBounds(138, 284, 300, 50);
		contentPane.add(Reserve);

		JButton Confirm = new JButton(new ImageIcon(
				"src/source/image/btn_res2.png"));
		Confirm.setBounds(532, 284, 300, 50);
		contentPane.add(Confirm);

		JButton homebtn = new JButton(
				new ImageIcon("src/source/image/home.png"));
		homebtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setVisible(false);
			}
		});
		homebtn.setBounds(870, 10, 64, 64);
		homebtn.setBorderPainted(false);
		contentPane.add(homebtn);

		Confirm.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (AccountManagement.User.getReserveList().equals("")) {
					JOptionPane.showMessageDialog(null, "You reserved nothing",
							"Reservation", JOptionPane.INFORMATION_MESSAGE);
				} else {
					JOptionPane.showMessageDialog(null,
							AccountManagement.User.getReserveList(),
							"Reservation", JOptionPane.INFORMATION_MESSAGE);
				}
			}
		});
	}
}
